/**
 * 
 */
package vue;

import java.awt.GridLayout;
import java.util.HashMap;
import java.util.Map;

import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * Create a frame that show information about the application.
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public class AboutDialog extends JDialog {

	private static final long				serialVersionUID	= 1L;
	/** default message */
	public static final String				ABOUT_MESSAGE		= "IGSAT\n\nThis product includes software developed by other : thanks to them ;)\nSee their website\n ";
	/** Default height */
	public static final int					HEIGHT				= 300;
	/** Default width */
	public static final int					WIDTH				= 700;

	/** Associate the "object" with its website */
	public static final Map<String, String>	website				= new HashMap<String, String>();

	static
	{
		website.put("MiniSat:", "http://minisat.se/MiniSat.html");
		website.put("Revival:", "http://www.cril.univ-artois.fr/~piette/revival/");
		website.put("Hypre:", "https://computation.llnl.gov/casc/hypre/software.html");
		website.put("Satellite:", "http://minisat.se/SatELite.html");
		website.put("RSat:", "http://reasoning.cs.ucla.edu/rsat/");
	}

	/**
	 * Create an {@link AboutDialog}, display some information about the application and other
	 * thanks.
	 */
	public AboutDialog() {
		JPanel pane = new JPanel();
		pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
		JScrollPane scroll = new JScrollPane(pane);

		setContentPane(scroll);

		// intro
		JTextArea intro = new JTextArea(ABOUT_MESSAGE);
		pane.add(intro);

		JPanel panel = new JPanel(new GridLayout(0, 2));

		for (String site : website.keySet())
		{
			panel.add(new JLabel(site));
			panel.add(new JLabel(website.get(site)));
		}
		pane.add(panel);

		setSize(WIDTH, HEIGHT);
		// setSize(getPreferredSize());
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	}


}
